<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <!-- 事件处理 -->
    <div id="app">
        <button @click="counter+=1">{{counter}}</button>
        <button v-on:click="ck">{{message}}</button>
        <button @click="say('hi')">内联处理器中的方法</button>

    </div>
    <script>
        // 创建Vue的对象
        let vm = new Vue({
            el:"#app",
            data:{
             message:'hello',
             counter:0,
             test:''
            },
            // 在 `methods` 对象中定义方法
            methods: {
                ck() {
                    this.message = this.message+' vue!!!'
                },
                say(message) { 
                    this.test = message;
                    alert(this.test);
                }
            }
        })
    </script>
</body>
</html>